#include "DList.h"

void TestDList1()
{
	ListNode* plist = ListInit();

	ListPushBack(plist, 1);
	ListPushBack(plist, 2);
	ListPushBack(plist, 3);
	ListPushFront(plist, 10);
	ListPushFront(plist, 20);
	//ListPushBack(plist, 4);
	//ListPushBack(plist, 5);
	//ListPushBack(plist, 6);

	ListPrint(plist);
}

void TestDList2()
{
	ListNode* plist = ListInit();

	ListPushBack(plist, 1);
	ListPushBack(plist, 2);
	ListPushBack(plist, 3);
	ListPushFront(plist, 10);
	ListPushFront(plist, 20);
	//ListPushBack(plist, 4);
	//ListPushBack(plist, 5);
	//ListPushBack(plist, 6);
	ListNode* pos = ListFind(plist, 2);
	if (pos != NULL)
		ListInsert(pos, 200);
	ListPrint(plist);
	pos = ListFind(plist, 1);
	if (pos != NULL)
		ListErase(pos, 200);
	ListPrint(plist);
}

void TestDList3()
{
	ListNode* plist = ListInit();

	ListPushBack(plist, 1);
	ListPushBack(plist, 2);
	ListPushBack(plist, 3);
	ListPrint(plist);
	/*ListPopBack(plist);
	ListPrint(plist);
	ListPopBack(plist);
	ListPrint(plist);
	ListPopBack(plist);
	ListPrint(plist);*/
	ListPopFront(plist);
	ListPrint(plist);
	ListPopFront(plist);
	ListPrint(plist);
	ListPopFront(plist);
	ListPrint(plist);
	ListPopFront(plist);

}

int main()
{
	TestDList3();
	return 0;
}